﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using Microsoft.VisualBasic;

namespace Microsina.Utility.ExtMethod
{
    public static class DataRowExt
    {
        public static int? GetInt(this DataRow dr, string colName)
        {
            object obj = dr[colName];
            if (obj != null && !dr.IsNull(colName))
            {
                int i = 0;
                if (int.TryParse(obj.ToString(), out i))
                {
                    return i;
                }
            }
            return null;
        }

        public static string GetString(this DataRow dr, string colName)
        {
            object obj = dr[colName];
            if (obj != null && !dr.IsNull(colName))
            {
                return obj.ToString();
            }
            return null;
        }

    }
}
